mbox is package{

  type mbox of %t is mbox{
    post has type action(%t);
    grab has type ()=>%t;
  }

  box() is mbox{
    private var Q := queue of {};
    private lock is 1; -- value not important
     
    grab() is valof{
      sync(lock){
        when Q matches _back(F,E) do{
          Q := F;
          valis E;
        }
      }
    }; 
    post(M) do {
      sync(lock) {
        Q := _cons(M,Q);
      }
    }
  }
}